﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Inspired.Euler
{
    public static class Problem040
    {
        static void Main()
        {
            StringBuilder sb = new StringBuilder("123456789");
            int i = 1;
            while (sb.Length < 1000000)
            {
                sb.Append(String.Format("{0}0{0}1{0}2{0}3{0}4{0}5{0}6{0}7{0}8{0}9", i++));
            }

            double product = 1;
            for(int n=0; n < 7; n++)
            {
                int index = (int)Math.Pow(10, n);
                product *= Char.GetNumericValue(sb[index - 1]);
            }
            product.DisplayAndPause();
        }
    }
}
